<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateCaseRequest extends FormRequest
{
    protected $errorBag = 'create';
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'=>'required|unique:cases',
            'remark'=>'required',
            'pic'=>'image'
        ];
    }
    public function messages()
    {
        return [
            'title.required' => '标题不得为空',
            'title.unique'  => '标题不能重复',
            'remark.required'=>'摘要不得为空',
            'pic.images' =>'不是图片类型'
        ];
    }
}
